﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Web.Mvc;

namespace WeBlog.Models
{
    public class BlogPostModel
    {
        public BlogPostModel()
        {
        }

        public BlogPostModel(BlogPost blogPost, IEnumerable<BlogPostComment> comments)
        {
            BlogPost = blogPost;
            Comments = comments;
        }
        public BlogPost BlogPost { get; private set; }

        public IEnumerable<BlogPostComment> Comments { get; private set; }
        public BlogPostComment NewComment { get; set; }
    }

    public class BlogPost
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required(ErrorMessage = "Title is required before posting a blog")]
        [Display(Name = "Title")]
        public string Title { get; set; }

        [Display(Name = "Date Posted")]
        public DateTime BlogDateTime { get; set; }

        [Required(ErrorMessage = "Blog Content is required before posting a blog")]
        [Display(Name = "Blog Message")]
        [AllowHtml]
        public string Body { get; set; }

        [Display(Name = "External Link")]
        public string ExternalLink { get; set; }

        [Display(Name = "Image")]
        public string ImagePath { get; set; }
    }
}